package game;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.geom.Point2D;

import loading.ImageLoader;
import math.Vector2D;

import button.MenuButton;

import gamestate.State;
import gamestate.StateStack;
import gui.user.User;

public class Menu extends State
{
	private MenuButton begin;
	public Menu(StateStack s, User u)
	{
		super(s, u);
		begin = new MenuButton(new Point2D.Double(512, 200), new ImageLoader("img/menu_begin.png"));
	}

	@Override
	public void render(Graphics2D g) 
	{
		begin.render(g);
	}

	@Override
	public void update(double duration) 
	{
		if (getUser().isPressed(KeyEvent.VK_ESCAPE))
			System.exit(0);
		Point2D mouse = getUser().getMousePos();
		if (mouse != null)
		{
			if (begin.clicked(mouse))
			{
				getStack().push(new InGame(getStack(), getUser()));
			}
		}
	}
	
}
